package com.Ajava1704.for并发包下的类.ForConditation;

/**
 * 作者: LCG
 * 日期: 2020/6/22 23:48
 * 描述:
 */
public class TestCondi {

    public static void main(String[] args) throws InterruptedException {

        TestConditation testConditation=new TestConditation();

        ThreadA threadA=new ThreadA(testConditation);

        threadA.start();


        ThreadB threadB=new ThreadB(testConditation);

        threadB.start();

        Thread.sleep(3000);

        testConditation.Asingal();


    }

    static class ThreadA extends Thread{

       private TestConditation testConditation;

        public ThreadA(TestConditation testConditation) {
            this.testConditation = testConditation;
        }

        @Override
        public void run() {
            testConditation.Await();
        }
    }


   static class ThreadB extends Thread{

        private TestConditation testConditation;

        public ThreadB(TestConditation testConditation) {
            this.testConditation = testConditation;
        }

        @Override
        public void run() {
            testConditation.Bwait();
        }
    }

}
